
"""
    Define some utility functions that may be used in other modules.
"""

import config as C
import datetime


def to_db_number_type(index) -> str:
    """
        Construct the given index into RealFaceDB-style index. such as:
            0   -> 00000
            128 -> 00128
    """
    index_str = str(index)
    while len(index_str) != 5:
        index_str = '0' + index_str

    return index_str


def debug(message: str):
    _log(f"DEBUG\t[{datetime.datetime.today()}]:\t{message}")


def info(message: str):
    _log(f"INFO\t[{datetime.datetime.today()}]:\t{message}")


def _log(message: str):
    if C.DEBUG_OUTPUT == C.DEBUG_OUTPUT_CONSOLE:
        print(message)
    elif C.DEBUG_OUTPUT == C.DEBUG_OUTPUT_FILE:
        ...
